<?php

class Application_Model_FotosProp extends Zend_Db_Table_Abstract
{
    protected $_name = 'fotosProp';
    protected $_primary = 'fotoId';
    protected $_rowClass = 'Application_Model_FotoProp';
    protected $_referenceMap = array(
        'Propostas' => array(
            'columns' => array('propostas_propId'),
            'refTableClass' => 'Application_Model_Propostas',
            'refColumns' => array('propId')
        ),
    );
    
    /**
     * @param int $id
     * @return Application_Model_Foto
     */
    public function getFotoPropById($id)
    {
        return $this->find($id)->current();
    }
    
    /** 
     * Fetch a dependent fotos rowset by evenos row 
     *
     * @param Application_Model_Evento $evRow
     * @return Zend_Db_Table_Rowset 
     */
    public function getFotosPropByProposta(Application_Model_Proposta $propRow)
    {
        return $propRow->findDependentRowset('Application_Model_FotosProp');
    }
}

